var __assign =
  (this && this.__assign) ||
  function () {
    __assign =
      Object.assign ||
      function (t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
      };
    return __assign.apply(this, arguments);
  };
import React from 'react';
import { Button, Form, Input, InputNumber, Modal, Radio, Select, Space, Switch } from 'antd';
var layout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 14 }
};
export function FormPropsSettingModal(props) {
  var formProps = props.formProps,
    visible = props.visible,
    setVisible = props.setVisible;
  var form = Form.useForm()[0];
  var handleChangeFormProps = function () {
    var values = form.getFieldsValue();
    if (!values.name) {
      values.name = undefined;
    }
    formProps.current = values;
    setVisible(false);
  };
  var handleCancel = function () {
    form.setFieldsValue(formProps.current);
    setVisible(false);
  };
  return React.createElement(
    React.Fragment,
    null,
    React.createElement(
      Button,
      {
        type: 'link',
        onClick: function () {
          return setVisible(true);
        }
      },
      'FormProps'
    ),
    React.createElement(
      Modal,
      {
        title: '\u8BBE\u7F6EForm\u7684\u5C5E\u6027',
        visible: visible,
        bodyStyle: { height: '60vh', overflow: 'auto' },
        onOk: handleChangeFormProps,
        onCancel: handleCancel
      },
      React.createElement(
        Form,
        __assign({ form: form }, layout, { initialValues: formProps.current }),
        React.createElement(
          Form.Item,
          { label: 'name', name: 'name' },
          React.createElement(Input, { prefix: '"', suffix: '"' })
        ),
        React.createElement(
          Form.Item,
          { label: 'labelCol', required: true },
          React.createElement(
            Space,
            null,
            React.createElement(
              Form.Item,
              { label: 'span', name: ['labelCol', 'span'], colon: false },
              React.createElement(InputNumber, { min: 0, max: 24 })
            ),
            React.createElement(
              Form.Item,
              { label: 'offset', name: ['labelCol', 'offset'], colon: false },
              React.createElement(InputNumber, { min: 0, max: 24 })
            )
          )
        ),
        React.createElement(
          Form.Item,
          { label: 'wrapperCol', required: true },
          React.createElement(
            Space,
            null,
            React.createElement(
              Form.Item,
              { label: 'span', name: ['wrapperCol', 'span'], colon: false },
              React.createElement(InputNumber, { min: 0, max: 24 })
            ),
            React.createElement(
              Form.Item,
              { label: 'offset', name: ['wrapperCol', 'offset'], colon: false },
              React.createElement(InputNumber, { min: 0, max: 24 })
            )
          )
        ),
        React.createElement(
          Form.Item,
          { label: 'colon', name: 'colon', required: true, valuePropName: 'checked' },
          React.createElement(Switch, null)
        ),
        React.createElement(
          Form.Item,
          { label: 'labelAlign', name: 'labelAlign', required: true },
          React.createElement(
            Radio.Group,
            null,
            React.createElement(Radio, { value: 'left' }, 'left'),
            React.createElement(Radio, { value: 'right' }, 'right')
          )
        ),
        React.createElement(
          Form.Item,
          { label: 'layout', name: 'layout', required: true },
          React.createElement(
            Radio.Group,
            null,
            React.createElement(Radio, { value: 'horizontal' }, 'horizontal'),
            React.createElement(Radio, { value: 'vertical' }, 'vertical'),
            React.createElement(Radio, { value: 'inline' }, 'inline')
          )
        ),
        React.createElement(
          Form.Item,
          {
            label: 'scrollToFirstError',
            name: 'scrollToFirstError',
            required: true,
            valuePropName: 'checked'
          },
          React.createElement(Switch, null)
        ),
        React.createElement(
          Form.Item,
          { label: 'size', name: 'size' },
          React.createElement(
            Select,
            { allowClear: true },
            React.createElement(Select.Option, { value: 'small' }, 'small'),
            React.createElement(Select.Option, { value: 'middle' }, 'middle'),
            React.createElement(Select.Option, { value: 'large' }, 'large')
          )
        ),
        React.createElement(
          Form.Item,
          { label: 'validateTrigger', name: 'validateTrigger', required: true },
          React.createElement(Input, { prefix: '"', suffix: '"' })
        ),
        React.createElement(
          Form.Item,
          { label: 'preserve', name: 'preserve', required: true, valuePropName: 'checked' },
          React.createElement(Switch, null)
        ),
        React.createElement(
          Form.Item,
          { label: 'requiredMark', name: 'requiredMark', required: true, valuePropName: 'checked' },
          React.createElement(Switch, null)
        )
      )
    )
  );
}
